package com.zhu.service.edu.controller.Front;

import com.zhu.commons.utils.R;
import com.zhu.service.edu.pojo.EduCourse;
import com.zhu.service.edu.pojo.EduTeacher;
import com.zhu.service.edu.service.IEduCourseService;
import com.zhu.service.edu.service.IEduTeacherService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("api/front/index")
@Api(tags = "首页")
//@CrossOrigin
public class Index {
    @Autowired
    private IEduTeacherService teacherService;
    @Autowired
    private IEduCourseService courseService;

    @ApiOperation("课程，讲师首页数据")
    @GetMapping
    public R index(){
        //查询热门课程 ，前8
       List<EduCourse> courseList= courseService.selectHotCourse();
       //查询热门教师
        List<EduTeacher> teacherList= courseService.selectHotTeacher();
        return R.ok().data("courseList",courseList).data("teacherList",teacherList);
    }
}
